import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import customers from "@/views/customers/customers.vue";
import product from "@/views/product/product.vue";
import login from "@/views/login/login.vue";

Vue.use(VueRouter)

export const routes: RouteConfig[] = [
  {
    path: '/',
    name:'login',
    component: login,
    meta: {show: false},
  },
  {
    path: '/index',
    name: 'index',
    redirect: '/welcome',
    component: () => import('@/views/dashboard/index.vue'),
    meta: {close: true},
  },
  {
    path: '/welcome',
    name: '首页',
    meta: {icon:'pie-chart',show: true,close: false},
    component: () => import('@/views/welcome/welcome.vue'),
  },
  {
    path: '/customers',
    name:'顾客管理',
    meta: {icon:'user',close: true},
    component: customers,
    children:[
      {
        name:'信息管理',
        path:'/customers',
        component:()=> import('@/views/customers/customers.vue'),
        meta:{title:'dashboard',icon:'profile',show: true},
      }
    ]
  },
  {
    path: '/product',
    name:'产品管理',
    meta: {icon:'shop',close: true},
    component: product,
    children:[
      {
        path:'product',
        component: () => import("@/views/product/product.vue"),
        meta:{icon:'laptop'},
      },
      {
        name:'手机管理',
        path:'/proPhone',
        component: () => import("@/views/product/proPhone/proPhone.vue"),
        meta:{icon:'mobile',show: true},
      },
      {
        name:'平板管理',
        path:'/slab',
        component: () => import("@/views/product/slab/slab.vue"),
        meta:{icon:'laptop',show: true},
      },
    ]
  },
  {
    path:'/showList',
    name:'购物清单',
    component:()=>import("@/views/showList/showList.vue"),
    meta: {close: true},
  },
  {
    path:'/404',
    name:'404页面',
    component: ()=> import("@/views/other/404.vue"),
    meta:{show: false,close: true},
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
